<?php
include_once("../function.php");
include_once("../class/ulevel_class.php");
include_once("../class/system_class.php");
include_once("../class/email_class.php");
error_reporting(E_ALL^E_NOTICE^E_WARNING);
if(!session_id()) session_start();
$us=getMemberbyID($_SESSION['ID']);
header("Content-Type: text/html;charset=utf-8");
if($_POST['submit']){
	$bdName=$_POST['bdName'];
	$rName=$_POST['rName'];
	$FatherName=$_POST['FatherName'];
	$TreePlace=$_POST['TreePlace'];
	$UserID=$_POST['UserID'];
	//$NickName=$_POST['NickName'];
	$NickName=$_POST['UserID'];
	$password1=$_POST['password1'];
	$password2=$_POST['password2'];
	$password3=$_POST['password3'];
	$passQuestion=$_POST['passQuestion'];
	$passAnswer=$_POST['passAnswer'];
	$UserCard=$_POST['UserCard'];
	$UserName=$_POST['UserName'];
//	$UserTel=$_POST['UserTel'];
	$UserAddress=$_POST['UserAddress'];
	$UserQQ=$_POST['UserQQ'];
	$BankName=$_POST['bankname'];
	$BankCard=$_POST['BankCard'];
	$BankUserName=$_POST['BankUserName'];
	$BankAddress=$_POST['BankAddress'];
	$useremail=$_POST['useremail'];
	$sex=$_POST['sex'];
	$nian=$_POST['nian'];
	$yue=$_POST['yue'];
	$ri=$_POST['ri'];
	$xueli=$_POST['xueli'];
	$zhifubao=$_POST['zhifubao'];
	$caifutong=$_POST['caifutong'];
	$userprovinceid="";
	$userprovinceid=isset($_POST['classification'])?$_POST['classification']:null;
	$usercityid=isset($_POST['menu'])?$_POST['menu']:null;
	$uLevel=$_POST['uLevel'];
/*	$zhengshi=$_POST['zhengshi'];*/


	$_ulevel=new ulevel_class();
	$ul=$_ulevel->getulevelbyulevel($uLevel);
	/*if($zhengshi==2){
        $jibie="信贷会员";
    }else{
        $jibie=$ul['lvname'];
    }*/

	$lsk=$ul['lsk'];
	$dan=$ul['dan'];
    $jibie=$ul['lvname'];
	$pv=0;
	$sheng=isset($_POST['province'])?$_POST['province']:null;
	$shi=isset($_POST['city1'])?$_POST['city1']:null;
	$xian="";
	$xian=isset($_POST['city2'])?$_POST['city2']:null;
	
	$zhuce=true;
	if(checkUserID($UserID) == true)
	{
		$zhuce=false;
		echo "<script language=javascript>alert('会员编号已存在,请刷新后再试.');window.location.href='register.php?nickname=".$FatherName."&tid=".$TreePlace."'</script>";
	}
/*    $sql="select count(*) as num from member where usertel=".$UserTel;
    $ustel=getOne($sql);
    if($ustel['num']>0)
    {
        $zhuce=false;
        echo "<script language=javascript>alert('该手机号已注册1个会员,请更换后再试.');window.location.href='register.php?nickname=".$FatherName."&tid=".$TreePlace."'</script>";
    }*/
	if(checkNickName($NickName) == true)
	{
		$zhuce=false;
		echo "<script language=javascript>alert('会员编号已存在,请更换后再试.');window.location.href='register.php?nickname=".$FatherName."&tid=".$TreePlace."'</script>";
	}
	if(checkNickName2($bdName) == false){
		$zhuce=false;
		echo "<script language=javascript>alert('服务中心编号不存在,请检查后再试.');window.location.href='register.php?nickname=".$FatherName."&tid=".$TreePlace."'</script>";
	}else{
		$array=getMemberbyNickName($bdName);
		$bdid=$array['id'];		
	}
	if(checkNickNamebyispay($rName) == false){
		$zhuce=false;
		echo "<script language=javascript>alert('推荐人编号不存在,或尚未激活,请检查后再试.');window.location.href='register.php?nickname=".$FatherName."&tid=".$TreePlace."'</script>";
	}else{
		$array=getMemberbyNickName($rName);
		$reid=$array['id'];
		$reLevel=$array['relevel']+1;
		$rePath="".$array['repath'].$array['id'].",";
	}
	if(checkNickNamebyispay($FatherName) == false){
		$zhuce=false;
		echo "<script language=javascript>alert('接点人编号不存在,或尚未激活,请检查后再试.');window.location.href='register.php?nickname=".$FatherName."&tid=".$TreePlace."'</script>";
	}else{
		$array=getMemberbyNickName($FatherName);
		$FatherID=$array['id'];
		$pLevel=$array['plevel']+1;
		$fplevel=$array['plevel'];
		$pPath="".$array['ppath'].$array['id'].",";
		$area1=$array['area1'];
		$area2=$array['area2'];
		$frecount=$array['recount'];
		$fxlevel=$array['xlevel'];
	}

	if(checkFatherMan($FatherID,$TreePlace) == true){
		$zhuce=false;
		echo "<script language=javascript>alert('该位置已有会员注册,请更换区域再试.');window.location.href='register.php?nickname=".$FatherName."&tid=".$TreePlace."'</script>";
	}
/*    if($array['recount']==0 and $TreePlace==2){
        $zhuce=false;
        echo "<script language=javascript>alert('接点人必须先激活左部门,才能在右部门注册.');window.location.href='register.php?nickname=".$FatherName."&tid=".$TreePlace."'</script>";
    }*/
/*	$_systemyeji=new system_class();
	$_sys=$_systemyeji->system_information(1);
	if($_sys['bdbonus']==1){
		if($area1==0 and $TreePlace==2){
			$zhuce=false;
			echo "<script language=javascript>alert('接点人必须先激活左区,才能在右区注册.');window.location.href='register.php?nickname=".$FatherName."&tid=".$TreePlace."'</script>";
		}
	}*/
	if($zhuce){
		$member['userid']=$UserID;
		$member['nickname']=$NickName;
		$member['password1']=md5($password1);
		$member['password2']=md5($password2);
		$member['password3']=md5($password3);
		$member['passquestion']=$passQuestion;
		$member['passanswer']=$passAnswer;
		$member['username']=$UserName;
		$member['usercard']=$UserCard;
		$member['usertel']=$UserID;
		$member['useraddress']=$UserAddress;
		$member['userqq']=$UserQQ;
		$member['bankname']=$BankName;
		$member['bankcard']=$BankCard;
		$member['bankuserName']=$BankUserName;
		$member['sheng']=$sheng;
		$member['shi']=$shi;
		$member['xian']=$xian;
		$member['bankaddress']=$BankAddress;
		$member['ulevel']=$uLevel;
		$member['dan']=$dan;
		$member['lsk']=$lsk;
		$member['pv']=$pv;
		$member['reid']=$reid;
		$member['rname']=$rName;
		$member['relevel']=$reLevel;
		$member['repath']=$rePath;
		$member['treeplace']=$TreePlace;
        	$member['fatherid']=$FatherID;
            $member['fathername']=$FatherName;
            $member['plevel']=$pLevel;
            $member['ppath']=$pPath;
		$member['bdid']=$bdid;
		$member['bdname']=$bdName;
		$member['useremail']=$useremail;
		$member['rdt']=now();
		$member['sex']=$sex;
		$member['nian']=$nian;
		$member['yue']=$yue;
		$member['ri']=$ri;
		$member['xueli']=$xueli;
		$member['zhifubao']=isset($zhifubao)?$zhifubao:null;
		$member['caifutong']=isset($caifutong)?$caifutong:null;
		$member['dan']=$dan;
		$member['isbd']=0;
       /* $member['fathername2']=$jibie;*/
		//$member['zcid']=$_SESSION['ID'];
		
		add_insert_cl('member',$member);
	/*	$_email=new email_class();
		$email=$_email->getemail();
		if ($email['zchy']==1){
			$_email->sendemail($member['useremail'],$member['nickname'],$email['hytitle'],$email['hycontent']);
		}*/
	}
	
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/table.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="css/style.css" />
<title>注册成功</title>
</head>
<body>
<table  width="100%" height="" cellpadding="3" cellspacing="1" border="0" align="center" class="table1">
	<tr>
    <td colspan="2" align="center">注册成功</td>
    </tr>
	<tr style="display:none">
	  <td width="50%" height="30" align="right">服务中心编号：</td>
	  <td width="50%" align="left"><?=$bdName?></td>
    </tr>
	<tr>
    <td width="50%" align="right">推荐人编号：</td>
    <td  width="50%" align="left">
      <?=$rName?></td>
  </tr>
  <tr style="display:none">
    <td align="right">接点人编号：</td>
    <td align="left">
      <?=$FatherName?></td>
  </tr>
  <tr style="display:none">
    <td align="right">安置区域：</td>
    <td align="left">
      <?=$quyu?></td>
  </tr>
  <tr>
    <td width="50%"  align="right">会员编号：</td>
    <td width="50%"  align="left">
      <?=$UserID?></td>
  </tr>
  <tr style="display:none">
    <td align="right">会员编号：</td>
    <td align="left"><?=$NickName?></td>
  </tr>
  <tr>
    <td width="50%"  align="right">一级密码：</td>
    <td width="50%"  align="left"><?=$_POST['password1']?></td>
  </tr>
  <tr>
    <td width="50%"  align="right">二级密码：</td>
    <td width="50%"  align="left"><?=$_POST['password2']?></td>
  </tr>
  <tr style="display:none">
    <td align="right">三级密码：</td>
    <td align="left"><?=$password3?></td>
  </tr>
  <tr style="display:none">
    <td align="right">密码安全问题：</td>
    <td align="left"><?=$passQuestion?></td>
  </tr>
  <tr style="display:none">
    <td align="right">密码安全答案：</td>
    <td align="left"><?=$passAnswer?></td>
  </tr>
  <tr style="display:none">
    <td align="right">身份证号码：</td>
    <td align="left"><?=$UserCard?></td>
  </tr>
  <tr>
    <td width="50%"  align="right">会员姓名：</td>
    <td width="50%"  align="left"><?=$UserName?></td>
  </tr>
  <tr>
    <td width="50%"  align="right">性别：</td>
    <td width="50%"  align="left">
	<?php if ($sex==1){?>男<?php }else{?>女<?php }?></td>
  </tr>
  <tr style="display:none">
    <td align="right">出生日期：</td>
    <td align="left"><?=$nian?>年<?=$yue?>月<?=$ri?>日</td>
  </tr>
  <tr style="display:none">
    <td align="right">学历：</td>
    <td align="left"><?=$xueli?></td>
  </tr>
  <tr style="display:none">
    <td align="right">联系电话：</td>
    <td align="left"><?=$UserTel?></td>
  </tr>
  <tr style="display:none">
    <td align="right">联系地址：</td>
    <td align="left"><?=$sheng?><?=$shi?><?=$xian?></td>
  </tr>
  <tr >
    <td align="right">详细地址：</td>
    <td align="left"><?=$UserAddress?></td>
  </tr>
  <tr style="display:none">
    <td align="right">微信号：</td>
    <td align="left"><?=$UserQQ?></td>
  </tr>
  <tr>
    <td width="50%"  align="right">开户银行：</td>
    <td width="50%"  align="left">
      <?=$BankName?></td>
  </tr>
  <tr>
    <td width="50%"  align="right">开户帐号：</td>
    <td width="50%"  align="left"><?=$BankCard?></td>
  </tr>
  <tr>
    <td width="50%"  align="right">开户姓名：</td>
    <td width="50%"  align="left"><?=$BankUserName?></td>
  </tr>
  <tr>
    <td width="50%"  align="right">开户地址：</td>
    <td width="50%"  align="left"><?=$BankAddress?></td>
  </tr>
  <tr style="display:none">
    <td align="right">支付宝账号：</td>
    <td align="left"><?=$zhifubao?></td>
  </tr>
  <tr style="display:none">
    <td align="right">财付通帐号：</td>
    <td align="left"><?=$caifutong?></td>
  </tr>
  <tr>
    <td width="50%"  align="right">加盟级别：</td>
    <td width="50%"  align="left">
      <?=$jibie?></td>
  </tr>
  <tr>
    <td width="50%"  align="right">汇款金额：</td>
    <td width="50%" ><?=$lsk?></td>
  </tr>
  <tr>
    <td  colspan="2" align="center">请尽快汇款至公司账户并与公司联系，确认收款后激活成为正式会员。</td>
  </tr>
  
  <tr>
    <td  colspan="2" align="center"><a href="register.php">继续注册</a></td> <!--<td colspan="" align="center"><a href="http://xinhoudao.rongyun188.com">立即登录</a>-->
  </tr>
  
</table>
</body>
</html>